package com.qiall.common.exception;

import lombok.Data;

@Data
public class BusinessException extends RuntimeException {
    protected Integer code;
    /**
     * code 和 errorMessage 的组合
     */
    protected String message;
    private String errorMessage;

    public BusinessException(ResultCode resultCode) {
        this.code = resultCode.code();
        this.errorMessage = resultCode.getErrorMessage();
        this.message=this.code+"|"+this.errorMessage;
    }

    public BusinessException() {

    }

    public BusinessException(ResultCode resultCode,String errorMessage) {
        this.code = resultCode.code();
        this.message = resultCode.code()+"|"+errorMessage;
        this.errorMessage=errorMessage;
    }

}
